<?php
header("Content-type:text/html;charset=utf8");
include('../config.php');
session_start();
if (isset($_SESSION['username']) && !empty($_SESSION['username'])) {
  $conn=new mysqli($dbconfig['host'],$dbconfig['user'],$dbconfig['pwd'],$dbconfig['dbname']);
  $sql='SELECT * FROM weizhi ORDER BY id DESC LIMIT 10';
  $result = mysqli_query( $conn, $sql );
  echo "<a href='http://www.gzhatu.com/dingwei.html'>超级经纬精确定位</a><br>";
  if ($result->num_rows > 0) {
      // 输出数据
      while($row = $result->fetch_assoc()) {
          //echo "id: " . $row["id"]. " - Name: " . $row["wd"]. " " . $row["jd"]. "<br>";
          $url="https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=".$row["wd"].",".$row["jd"]."&key=&radius=10&extensions=all";//key自行填写，请在高德地图申请
  
  
          $html = file_get_contents($url);
          $b=json_decode($html);
          $dz=$b->regeocode->formatted_address;

          echo $row["ip"]."#######经度:".$row["wd"]."##纬度：".$row["jd"]."##附近地址：";var_dump($dz);echo "##记录时间".$row["reg_date"]."<br>";
          
      }
  } else {
      echo "0 结果";
  }
  
  
}else{
    echo "你还没有登录，<a href='index.html '>请登录</a>";
}
?>
